UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Nmmw5N3OR42ZQOZfuwq0s9OsrU+/ruUfpImFKXNJxgY='
WHERE
key_id = 'cfdf042ac67986fa1c6f81a227f980bd76a4c8dc573e2adf0514b2b01993e5ee'
AND (
token = 'Nmmw5N3OR42ZQOZfuwq0s9OsrU+/ruUfpImFKXNJxgY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)