UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fY497FEiXWajiN1zPt9unExQJGhE/gs9C2mGa00eehs=' 
WHERE 
  key_id = '863923f49dab0674d325eff24392b969181a0c185f9c174d871be88c9fd6be96' 
  AND (
    token = 'fY497FEiXWajiN1zPt9unExQJGhE/gs9C2mGa00eehs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032