UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k9GMhuqnfnxDff6R3JJjn4kFOKdQGEXXD8pCOs9ndF8='
WHERE
key_id = 'f22164ba48e7a6ac42419b4212bc67bbb347b964f7ccecdf6c0a586b1538eeba'
AND (
token = 'k9GMhuqnfnxDff6R3JJjn4kFOKdQGEXXD8pCOs9ndF8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)