UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FwSsY5LvzMeeI2ESu0Y6ICMLY0NWkK6zhMt+RRFrRyk='
WHERE
key_id = 'c21a1e0e0c1325852ea0900e38be76bd0ccf0608f86b2eeab66938836e522e8a'
AND (
token = 'FwSsY5LvzMeeI2ESu0Y6ICMLY0NWkK6zhMt+RRFrRyk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)