UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TyzVRZL/pGV5BN72M/4c7HH3pFUkGOsPozmOY1E+1/Y='
WHERE
key_id = 'fb0709d976c7cc051427c85f27da22d93bfb1963c8703f3362e34755e310f8d7'
AND (
token = 'TyzVRZL/pGV5BN72M/4c7HH3pFUkGOsPozmOY1E+1/Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)