UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XzFmgS72iSyX/eTt0WaNlToHLYh9Upl1LV2PpN3JcE4='
WHERE
key_id = '3fcdeb7b7f1341643eac82ab0dd65ef3b098a66c2a8f463f561b8d6ec03eca30'
AND (
token = 'XzFmgS72iSyX/eTt0WaNlToHLYh9Upl1LV2PpN3JcE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)