UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K+aQTlaqWe4/d8jXjtflyGBQIQHvqLycTJXnKp5HZRs='
WHERE
key_id = 'b7bbff2168c01dfcbfa35c57bdf26c5c26f0d5e41c1d8eb9f87d2f43fbbf7a13'
AND (
token = 'K+aQTlaqWe4/d8jXjtflyGBQIQHvqLycTJXnKp5HZRs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)