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