UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xRPQAionoK7KkPELAQ/L9t7dZIHKzJsD5wLdoHjJRa0='
WHERE
key_id = 'e17f227867caad063b216325b9c37d1a0555097bf65bb953f60383cad5f3df91'
AND (
token = 'xRPQAionoK7KkPELAQ/L9t7dZIHKzJsD5wLdoHjJRa0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)