UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UFYn4+QYcIylSV6Mz3XozdiuE1UAQ7M1YeZG4wdyww8='
WHERE
key_id = '4314514c599bbe255d41f0e911dd5ad2ce59a2400839dae89208c5c7d745f3b0'
AND (
token = 'UFYn4+QYcIylSV6Mz3XozdiuE1UAQ7M1YeZG4wdyww8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)