UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cE0Y3O2nsCTp9eQD5mBcQk5mtQgpQ2os6PVLeFnkTns=' 
WHERE 
  key_id = 'c31bde0f4d95e1cb5942d85fe7189c44b3cfd0c67b0c50559e2dd3dee6051e91' 
  AND (
    token = 'cE0Y3O2nsCTp9eQD5mBcQk5mtQgpQ2os6PVLeFnkTns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037