UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm8FQ+4TcLBfurN0sagfFIk7qq9C3FVkUicDJp8azVSk='
WHERE
key_id = '8b5bae60854b5312e39c11c9a643d9ceeac6e7b387983733d2c5383b7e674e2d'
AND (
token = 'm8FQ+4TcLBfurN0sagfFIk7qq9C3FVkUicDJp8azVSk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)