UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'erX3h1bMieQcYzOT18wZbQ0hD+/YXXO1QP0G1rd/8vY='
WHERE
key_id = 'e0eace41922350739129cbf8ca8aade7faef421e9a823d8ecb39c84cf207eefb'
AND (
token = 'erX3h1bMieQcYzOT18wZbQ0hD+/YXXO1QP0G1rd/8vY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)