UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9rpp6SlrrPgEeHtIHFYCAubO90A8sPUhP7feWHZTOn4='
WHERE
key_id = 'db503c1ce2ad3a1a715f78ae2c550228bb4cfe1edd1fd5cf05ca7d808ac8107d'
AND (
token = '9rpp6SlrrPgEeHtIHFYCAubO90A8sPUhP7feWHZTOn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)