UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '61QTPum6nHxzRVuomm3ChfYzGWyuvNsBuCJgHM8JLb8=' 
WHERE 
  key_id = '343da36eea577cf6b2d6bd40dcf5ccc994975caca5971c96240871cb6db26a52' 
  AND (
    token = '61QTPum6nHxzRVuomm3ChfYzGWyuvNsBuCJgHM8JLb8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032