UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k1WlC6IvWrNxqs74LKIcOYvNuj9M5e/P208ZiWppyn8='
WHERE
key_id = 'b1176a32e99210f2b72cbddcb309438995165ed823f85f8b72b943ae386eaad1'
AND (
token = 'k1WlC6IvWrNxqs74LKIcOYvNuj9M5e/P208ZiWppyn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)