UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2XFGYvGivagv2pQkPp2nIu18BruvupiG6Mhaq05bp9E=' 
WHERE 
  key_id = 'c778653b76f7723048d7b86a63418a932a46b8d871ad9d76ba792d1d62163e3d' 
  AND (
    token = '2XFGYvGivagv2pQkPp2nIu18BruvupiG6Mhaq05bp9E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050