UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'afwIwqXUsZOH/PX7fSLacTXe4xWEKw5vXD35DJlqQQ0='
WHERE
key_id = '27164267ef6679959083d20519a16626366f5293eb9c5edcc827f37622b7d41c'
AND (
token = 'afwIwqXUsZOH/PX7fSLacTXe4xWEKw5vXD35DJlqQQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)