UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9OxCixd8b0wEl7S+DwrdL6HqL9StC9LZYf/i65XGhA='
WHERE
key_id = 'a7ec2f4e2f617124a71eb42aa7438bce1b8ec6fd1c2b595c7f60e691b475f091'
AND (
token = 'C9OxCixd8b0wEl7S+DwrdL6HqL9StC9LZYf/i65XGhA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)