UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N9tlaF0MhDCsgBbczNVXaZEs3sQ/Z8xyY5Zmo9gc0G4=' 
WHERE 
  key_id = 'c8dfaeb2670ebe1159f5e0d24706b88341d7b877b6029297a0ca9c3d6af4456c' 
  AND (
    token = 'N9tlaF0MhDCsgBbczNVXaZEs3sQ/Z8xyY5Zmo9gc0G4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016