UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AtH1rMe6v8wNJP4JWVjs2+1zF9aH8bsAvcdNw/d3/aQ=' 
WHERE 
  key_id = 'be24c67d1663ce5e7e7cbc39d058ce261ff93291df2da55ce2eeb8e94ce87c44' 
  AND (
    token = 'AtH1rMe6v8wNJP4JWVjs2+1zF9aH8bsAvcdNw/d3/aQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018