UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y5Tc1L2JvioUxKbtjLfgl5ZP1lgxpYrdQL5i0TBgqiI='
WHERE
key_id = '2431c2c9c99b819e989c961593675bde415a4b8119afb98767f40b70d0afeea5'
AND (
token = 'Y5Tc1L2JvioUxKbtjLfgl5ZP1lgxpYrdQL5i0TBgqiI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)