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