UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cPmAOJc0JI7yzvRWgrKyPGI9IyNnpZZcd5ms+XRhdoQ='
WHERE
key_id = 'c2358a9d42469f407066f4c0c8b37d4fa546427488b03538f2b8b8832deadde8'
AND (
token = 'cPmAOJc0JI7yzvRWgrKyPGI9IyNnpZZcd5ms+XRhdoQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)