UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8HjDXaKZ7fUOBZbemTUyimOXeGpw/74NvnD1Eg49Ufo='
WHERE
key_id = 'd1a2765a06206f2309d7a9b14c0b0b80df0d8d4b43cd033ab717d9f49a2c13fc'
AND (
token = '8HjDXaKZ7fUOBZbemTUyimOXeGpw/74NvnD1Eg49Ufo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)