UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2aS9iomRv87J8va+HmVbIyJ9Hf4qeGEEgaWWU716T8='
WHERE
key_id = 'd7e7005ae164c6177f6ddfbc6ac090404fdd3777c80f7e428c3e792d161a49d3'
AND (
token = 'a2aS9iomRv87J8va+HmVbIyJ9Hf4qeGEEgaWWU716T8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)