UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R9RDD39wVKaRxyNOX+Rx1AMd/GnxEWlhTMY77RmPIwE='
WHERE
key_id = 'd168afb8013725bdd1d576ad743beda9fd97d6cf6844d6745513a19f824e5b87'
AND (
token = 'R9RDD39wVKaRxyNOX+Rx1AMd/GnxEWlhTMY77RmPIwE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)