UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q8k2z4GElJczwdAlmaRSOnDDw4vGZl6lLycZ5ImVplA='
WHERE
key_id = '835bc251a1f8737306286bdc8f541d3e5d9762c2dbffa992a73d41ac268ce7fc'
AND (
token = 'q8k2z4GElJczwdAlmaRSOnDDw4vGZl6lLycZ5ImVplA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)