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

Query time 0.00032