UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaUMEVJ5IeCFYy7E7u1kRp6B55AYUu0Dz/a1DhTAL0Y='
WHERE
key_id = 'f2f9297e1387bd7cb0a1b6a2c6a029c210a6e5ddaed0df60fb928ae2cea04d0e'
AND (
token = 'NaUMEVJ5IeCFYy7E7u1kRp6B55AYUu0Dz/a1DhTAL0Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)