UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tX0eq69H7EneOq+hB6zyEMXkxJr8z6C48vztTswmAAQ='
WHERE
key_id = 'b659aae5ccca2357676c60ca9cbbe46d7065f939ee5d77ba1f1b28c90ccce59b'
AND (
token = 'tX0eq69H7EneOq+hB6zyEMXkxJr8z6C48vztTswmAAQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)