UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WcmK8uEs4Q5tBqZAUSxv628x7vC3v1r4uOTNqRLWBGs='
WHERE
key_id = 'c6971f8bfb612b28511af81f4cc4bc4e2babd63f09810f4177b3fd6390924c7a'
AND (
token = 'WcmK8uEs4Q5tBqZAUSxv628x7vC3v1r4uOTNqRLWBGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)