UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GKCe8RlhAn5k02+x+bebtmNoZN4P7+OidCSIxzUDGNI='
WHERE
key_id = 'd60cf053367a478bebe58060aae842cdcf671c7bace98531e068fa93bff80fcf'
AND (
token = 'GKCe8RlhAn5k02+x+bebtmNoZN4P7+OidCSIxzUDGNI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)