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