UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3OAhXXaCBqJqq88NrZBBt4prPpTnBl/wFZMqf9xZsyw='
WHERE
key_id = 'be745f76e33ef20b6582a1caf5b77a086746e03e180fcce7c22b6bb6c2c6f8ad'
AND (
token = '3OAhXXaCBqJqq88NrZBBt4prPpTnBl/wFZMqf9xZsyw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)