UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NWBb1RnXKxRrcvuRf8PwaG2nzbk50fyD6uniJdKNjn0='
WHERE
key_id = '9cd676e5e3bd7a1bded475925f31d34d75f16f870b2b2920b3c57618be6dc7ec'
AND (
token = 'NWBb1RnXKxRrcvuRf8PwaG2nzbk50fyD6uniJdKNjn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)