UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xVerwC+lWnVjdbmHNg81/tROPM0WpJw4nLScNNejKvk=' 
WHERE 
  key_id = 'b97ed9d1c44694f1cd374da434367d5af2d448e352f96fad198babf62508e490' 
  AND (
    token = 'xVerwC+lWnVjdbmHNg81/tROPM0WpJw4nLScNNejKvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032